{extend name="template/base" /}
{block name="style"}
{php}use think\Db;{/php}
<!--select2样式 start -->
<link href="__LIB__/select2-4.0.3/dist/css/select2.min.css" rel="stylesheet" />
<style>
    .evaluate_top_info{
        background-color: #f5fafe;
        margin-left: 10px;
        margin-right: 10px;
    }
    .evaluate_text{
        text-align: left;
        margin-bottom: 5px;
        margin-left: 10px;
        margin-right: 10px;
        font-weight: normal;
        font-size: 16px;
    }
    .evaluate_info{
        text-align: left;
    }
    .evaluate_info p{
        font-weight: normal;
        font-size: 16px;
        min-width: 200px;
        max-width: 350px;
    }
    .evaluate_bottom_info{
        text-align: left
    }
    .evaluate_bottom_info p{
        font-weight: normal;
        font-size: 16px;
        margin-left: 10px;
        margin-right: 10px;
    }
    .img_nav{
        padding: 10px;
    }
    img{
        margin: 10px;
        width: 150px;
        /*height: auto;*/
        height: 100px;
    }
    .mr-b-10{
        margin-bottom: 10px;
    }
    .is_show{
        display: block;
    }
</style>
<!--select2样式 end -->
{/block}
{block name="content"}
<div class="page-container">
    {if $driver_from == 1}
    <form class="form form-horizontal" id="form" method="post" action="{:\\think\\Request::instance()->baseUrl()}">
        <input type="hidden" name="id" value="{$data.id ?? ''}">
        <input type="hidden" name="driver_from" value="{$driver_from ?? ''}">
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">预支付标准：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="预支付标准" name="prepaid_expenses" value="{$data.prepaid_expenses ?? ''}" >
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">起始油表：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="起始油表" name="start_gauge_value" value="{$data.start_gauge_value ?? ''}">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">结束油表：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="结束油表" name="end_gauge_value" value="{$data.end_gauge_value ?? ''}">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">起始里程：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="起始里程" name="start_odometer_value" value="{$data.start_odometer_value ?? ''}" >
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">结束里程：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="结束里程" name="end_odometer_value" value="{$data.end_odometer_value ?? ''}" >
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">保险费用：</label>
            <div class="formControls col-xs-6 col-sm-6">
                {php}
                    $data['insurance_expenses'] = Db::name('dispatch_insurance')->where('group_id',$data['id'])->value('insurance_money');
                {/php}
                <input type="text" class="input-text" placeholder="保险费用" name="insurance_expenses" value="{$data.insurance_expenses ?? ''}" >
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">好评数：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="好评数" name="comment_praise" value="{$data.comment_praise ?? ''}">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">差评数：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="差评数" name="comment_negative" value="{$data.comment_negative ?? ''}">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">好评率：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="不填则由系统自动算出" name="feedback" value="{$data.feedback ?? ''}">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">其它扣款：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="其它扣款" name="other_deduct_money" value="{$data.other_deduct_money ?? ''}" >
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">是否达标：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <select name="is_reach_standard" class="select">
                    <option value="">选择是否达标</option>
                    <option value="1" {eq name="data.is_reach_standard" value="1"} selected = "selected" {/eq} >是</option>
                    <option value="0"  {eq name="data.is_reach_standard" value="0"} selected = "selected" {/eq}>否</option>
                </select>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">备注：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <textarea  name="remark" class="textarea">{$data.remark ?? ''}</textarea>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <div id="content"></div>
                <input id="type" name="type" type="text" style="display: none" value="{$type}">
                <button type="button" class="btn btn-primary radius"onclick="submitSriver()">&nbsp;&nbsp;提交&nbsp;&nbsp;</button>
                <button type="button" class="btn btn-default radius ml-20" onClick="layer_close();">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
            </div>
        </div>
    </form>
    {else/}
    <form class="form form-horizontal" id="form" method="post" action="{:\\think\\Request::instance()->baseUrl()}">
        <input type="hidden" name="id" value="{$data.id ?? ''}">
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">司机费用：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="司机费用" name="driver_fee" value="{$data.driver_fee ?? ''}" >
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">司机补偿金：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="司机补偿金" name="driver_compensation" value="{$data.driver_compensation ?? ''}">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">公司补偿金：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="公司补偿金" name="company_compensation" value="{$data.company_compensation ?? ''}" >
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">差评扣款：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="差评扣款" name="deduct_money" value="{$data.deduct_money ?? ''}" >
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">保险费用：</label>
            {php}
                $data['insurance_expenses'] = Db::name('dispatch_insurance')->where('group_id',$data['id'])->value('insurance_money');
            {/php}
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="保险费用" name="insurance_expenses" value="{$data.insurance_expenses ?? ''}" >
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">其它扣款：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="其它扣款" name="other_deduct_money" value="{$data.other_deduct_money ?? ''}" >
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">好评数：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="好评数" name="comment_praise" value="{$data.comment_praise ?? ''}">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">差评数：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="差评数" name="comment_negative" value="{$data.comment_negative ?? ''}">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">好评率：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="不填则由系统自动算出" name="feedback" value="{$data.feedback ?? ''}">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">是否达标：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <select name="is_reach_standard" class="select"  id="is_reach_standard">
                    <option value="">选择是否达标</option>
                    <option value="1" {eq name="data.is_reach_standard" value="1"} selected = "selected" {/eq} >是</option>
                    <option value="0"  {eq name="data.is_reach_standard" value="0"} selected = "selected" {/eq}>否</option>
                </select>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">备注：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <textarea  name="remark" class="textarea">{$data.remark ?? ''}</textarea>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <div id="content"></div>
                <input id="type" name="type" type="text" style="display: none" value="{$type}">
                <button type="button" class="btn btn-primary radius"onclick="submitSriver()">&nbsp;&nbsp;提交&nbsp;&nbsp;</button>
                <button type="button" class="btn btn-default radius ml-20" onClick="layer_close();">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
            </div>
        </div>
    </form>
    {/if}
    <div class="is_show">
        <span class="l pt-5 pr-5" style="margin: 10px;">
              <span style="text-decoration:none" class="label label-warning radius">订单好评数：{$comment_praise}</span>
              <span style="text-decoration:none" class="label label-warning radius">订单差评数：{$comment_negative}</span>
              <span style="text-decoration:none" class="label label-warning radius">订单无评论数：{$not_comment}</span>
        </span>
        {volist id="order_info" name="order_info"}
        <div class="cl pd-5 mr-b-10" style="margin-top: 12px">
            <table class="table table-border table-bordered table-hover table-bg mt-20">
                <thead>
                <th colspan="6">
                    <div class="evaluate_top_info">
                    <span class="l pt-5 pr-5" style="margin-left: 10px">
                          <span style="text-decoration:none" class="label label-warning radius">订单号：{$order_info.order_id}</span>
                          <span style="text-decoration:none" class="label label-warning radius">花儿评价：{$order_info.order_evaluate_status}</span>
                     </span>
                        <span class="r pt-5 pr-5">
                        <span style="text-decoration:none" class="label label-warning radius">{$order_info.dispose_status_name}</span>

                    </span>
                    </div>
                </th>
                </thead>
                <tbody>
                {if !empty($order_info.order_evaluate)}
                    <tr>
                        <th colspan="4">
                            <p class="evaluate_text">用户评价：<span>{$order_info.order_evaluate.comment}</span></p>
                            <div class="l" align="left" class="img_nav">
                                {volist id="img_list" name="$order_info.order_evaluate.img_src"}
                                <a onclick="open_img('{$img_list}')"><img src="{$img_list}"></a>
                                {/volist}
                            </div>
                        </th>
                        <th colspan="2" class="evaluate_info">
                            <p>订单号：{$order_info.order_id}</p>
                            <p>产品名称：{$order_info.sales_name?'':'暂无信息'}</p>
                            <p>评论者昵称：{$order_info.order_evaluate.user_name}</p>
                            <p>订单预订者：{$order_info.booking_people_name}</p>
                            <p>订单预订者手机号：{$order_info.booking_people_phone}</p>
                            <p>来源：{$order_info.platform_name}</p>
                        </th>
                    </tr>
                    <tr>
                        <th colspan="6" class="evaluate_bottom_info">
                            <p>点评时间：{$order_info.order_evaluate.create_time?date('Y-m-d H:i:s',$order_info.order_evaluate.create_time):"--"}</p>
                        </th>
                    </tr>
                    {if !empty($order_info.order_evaluate.review)}
                    <tr>
                        <th colspan="4">
                            <p class="evaluate_text">用户追评：<span>{$order_info.order_evaluate.review}</span></p>
                        </th>
                        <th colspan="2" class="evaluate_info">
                        </th>
                    </tr>
                    {/if}
                {else/}
                <tr>
                    <th colspan="4">
                        <p class="evaluate_text" style="text-align: center;margin: 5px">该订单暂无评价信息</span></p>
                    </th>
                    <th colspan="2" class="evaluate_info">
                        <p>订单号：{$order_info.order_id}</p>
                        <p>产品名称：{$order_info.sales_name?'':'暂无信息'}</p>
                        <p>评论者昵称：暂无信息</p>
                        <p>订单预订者：{$order_info.booking_people_name}</p>
                        <p>订单预订者手机号：{$order_info.booking_people_phone}</p>
                        <p>来源：{$order_info.platform_name}</p>
                    </th>
                </tr>
                {/if}
                </tbody>
            </table>
        </div>
        {/volist}
    </div>


</div>
{/block}
{block name="script"}

<!--时间插件-->
<script type="text/javascript" src="__LIB__/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="__LIB__/Validform/5.3.2/Validform.min.js"></script>
<script type="text/javascript" src="__LIB__/template/template.js"></script>
<!--select2 js 插件-->
<script type="text/javascript" src="__LIB__/select2-4.0.3/dist/js/select2.min.js"></script>
<script type="text/javascript" src="__LIB__/layer/2.4/layer.js"></script>
<script>
    function open_img(src) {
        window.open(src);
    }
    function submitSriver() {
        $.ajax({
            type: 'post',
            url: '/admin/dispatch_traveler_group/apply_settlement',
            data: $('#form').serializeArray(),
            success: function (data) {
                console.log('data', data);
                if (data.code == 0) {
                    layer.msg(data.msg, {
                        icon: 1,
                        shift: -1,
                        time: 2000 //2秒关闭（如果不配置，默认是3秒）
                    }, function () {
                        window.parent.location.reload();
                        var index = parent.layer.getFrameIndex(window.name); //获取窗口索引\
                        parent.layer.close(index)
                    });
                } else {
                    layer.msg(data.msg, {
                        icon: 5,
                        time: 2000 //2秒关闭（如果不配置，默认是3秒）
                    });
                }
            },
            error: function (data) {
                layer.msg(data.msg, {
                    icon: 5,
                    time: 2000 //2秒关闭（如果不配置，默认是3秒）
                });
                console.log('data', data);
            }
        });
        return false
    }
</script>
{/block}
